package kr.couponplay.android.activity.deal.menu;

import java.util.ArrayList;
import java.util.List;

import kr.couponplay.android.activity.deal.category.CategoryHelper;
import android.graphics.Color;
import android.view.View;

public class TopMenuHelper {
	public static List<TopMenuButton> topMenuButtons = new ArrayList<TopMenuButton>();
	public static int selectedTopMenuButtonIndex = 0;
	
	public static void selectTopMenuButton(View view) {
		for (int i=0; i<topMenuButtons.size(); i++) {
			TopMenuButton button = topMenuButtons.get(i);
			if (view == button.getButton()) {
				button.getButton().setBackgroundColor(Color.parseColor("#3F92E3"));
				button.getButton().setTextColor(Color.parseColor("#ffffff"));
				CategoryHelper.mainCategoryId = button.getCategory().getId();
				TopMenuHelper.selectedTopMenuButtonIndex = i;
			} else {
				button.getButton().setBackgroundColor(Color.parseColor("#2F6CB0"));
				button.getButton().setTextColor(Color.parseColor("#B7C6D5"));
			}
		}
	}
	
	public static boolean isTopMenuButton(View view) {
		for (TopMenuButton button : topMenuButtons) {
			if (view == button.getButton()) {
				return true;
			}
		}
		return false;
	}
	
	public static int getMainCategoryId(int position) {
		return topMenuButtons.get(position).getCategory().getId();
	}
	
	public static void clear() {
		TopMenuHelper.topMenuButtons.clear();
		TopMenuHelper.selectedTopMenuButtonIndex = 0;
	}
}
